package com.ruoyi.project.wodemand.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.wodemand.domain.TLogSheetdeal;
import com.ruoyi.project.wodemand.service.ITLogSheetdealService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 流程审批日志Controller
 *
 * @author lt
 * @date 2020-04-14
 */
@RestController
@RequestMapping("/wodemand/SHEETDEAL")
public class TLogSheetdealController extends BaseController
{
    @Autowired
    private ITLogSheetdealService tLogSheetdealService;

    /**
     * 查询流程审批日志列表
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:list')")
    @GetMapping("/list")
    public TableDataInfo list(TLogSheetdeal tLogSheetdeal)
    {
        startPage();
        List<TLogSheetdeal> list = tLogSheetdealService.selectTLogSheetdealList(tLogSheetdeal);
        return getDataTable(list);
    }

    /**
     * 导出流程审批日志列表
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:export')")
    @Log(title = "流程审批日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TLogSheetdeal tLogSheetdeal)
    {
        List<TLogSheetdeal> list = tLogSheetdealService.selectTLogSheetdealList(tLogSheetdeal);
        ExcelUtil<TLogSheetdeal> util = new ExcelUtil<TLogSheetdeal>(TLogSheetdeal.class);
        return util.exportExcel(list, "SHEETDEAL");
    }

    /**
     * 获取流程审批日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:query')")
    @GetMapping(value = "/{sheetId}")
    public AjaxResult getInfo(@PathVariable("sheetId") Long sheetId)
    {
        return AjaxResult.success(tLogSheetdealService.selectTLogSheetdealById(sheetId));
    }

    /**
     * 新增流程审批日志
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:add')")
    @Log(title = "流程审批日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TLogSheetdeal tLogSheetdeal)
    {

        return toAjax(tLogSheetdealService.insertTLogSheetdeal(tLogSheetdeal));
    }

    /**
     * 修改流程审批日志
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:edit')")
    @Log(title = "流程审批日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TLogSheetdeal tLogSheetdeal)
    {
        return toAjax(tLogSheetdealService.updateTLogSheetdeal(tLogSheetdeal));
    }

    /**
     * 删除流程审批日志
     */
    @PreAuthorize("@ss.hasPermi('wodemand:SHEETDEAL:remove')")
    @Log(title = "流程审批日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sheetIds}")
    public AjaxResult remove(@PathVariable Long[] sheetIds)
    {
        return toAjax(tLogSheetdealService.deleteTLogSheetdealByIds(sheetIds));
    }
}
